function gotoTop() {
	var right ="30px"; 
	var backToTopEle = $('');
	backToTopEle.appendTo($("body")).css("right",right).click(function() {
			jQuery("html, body").animate({ scrollTop: 0 }, 120);
	});
	var jQuerybackToTopFun = function() {
			var st = $(document).scrollTop(), winh = $(window).height();
			var h = $(window).width();
			(h>950&&st>0)? backToTopEle.show(): backToTopEle.hide();			
			//IE6下的定位
			if (!window.XMLHttpRequest) {
					backToTopEle.css("top", st + winh - 208);
			}
	};
	$(window).bind("scroll", jQuerybackToTopFun);
	$(window).bind("resize", jQuerybackToTopFun);
	$(function() {jQuerybackToTopFun();});
}

function animate() {
	$(".animeta").find("li").each(function(i) {
		$(this).mouseover(function() {
			$(this).addClass("cur").siblings().removeClass("cur");
			$(".animeta").find("img").hide().eq(i).show();
		});
	});
}

/*排行榜*/
function ranking() {
	$(".ranking").find("li").mouseover(function() {
		$(this).addClass("on").siblings().removeClass("on");
	});
}

function trim(tmp) {
    return tmp.replace(/^\s*/, "").replace(/\s*$/, "");
}

function sendweibo(title,pic){
	var _w = 72 , _h = 16;
	var param = {
	url:location.href+'&from=weibo',
	type:'3',
	count:'1',
	appkey:'1044786919', 
	title:title, 
	pic:pic, 
	ralateUid:'', 
	rnd:new Date().valueOf()
	}
	var temp = [];
	for( var p in param ){
	temp.push(p + '=' + encodeURIComponent( param[p] || '' ) )
	}
	document.write('<iframe allowTransparency="true" frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?' + temp.join('&') + '" width="'+ _w+'" height="'+_h+'"></iframe>')
}


$(function() {
	$(".subitem:gt(3)").css({"right":"-1px","left":"auto"});
	$(".hasmenu").hover(function() {
		$(this).find(".subitem").removeClass("hide");
	},
	function() {
		$(this).find(".subitem").addClass("hide");	
	});
	animate();
	gotoTop();
	ranking()
})
